package com.cloud.code.牛客网;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

/**
 * HJ66 配置文件恢复
 */
public class Test15 {

    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("reset", "reset what");
        map.put("reset board", "board fault");
        map.put("board add", "where to add");
        map.put("reboot backplane", "impossible");
        map.put("backplane abort", "install first");
        map.put("board delete", "no board at all");
        map.put("noMatch", "unknown command");

        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String s = scanner.nextLine();
            String s1 = map.get("s");
            if (s1 != null) {
                System.out.println(s1);
            } else {
                String[] comd = s.split(" ");
                AtomicInteger count = new AtomicInteger(0);
                AtomicReference<String> keys = new AtomicReference<>("null");
                map.forEach((key, tem) -> {
                    String[] s2 = key.split(" ");
                    if(comd.length>1 && s2.length>1){
                        if (s2[0].indexOf(comd[0]) == 0 && s2[1].indexOf(comd[1]) == 0) {
                            count.getAndIncrement();
                            keys.set(key);
                        }
                    }else {

                        if(key.indexOf(s)==0 && s2.length==1){
                            keys.set(key);
                            count.getAndIncrement();
                        }
                    }
                });

                if(count.intValue() > 1 || keys.get().equals("null")){
                    System.out.println("unknown command");
                }else {
                    System.out.println(map.get(keys.get()));
                }
            }
        }
    }
}
